package com.esp.soccertutor.ui.adpater;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.esp.soccertutor.R;
import com.esp.soccertutor.ui.bean.BeanCategory;

public class ShowcaseAdapter extends ArrayAdapter<BeanCategory> {
	
	static class ViewHolder {
		protected TextView mTextView;
	}
	private Context mContext;
	
	private ArrayList<BeanCategory> arrylstCategory;
	public ShowcaseAdapter(Context context,ArrayList<BeanCategory> object) {
		super(context,R.layout.row_showcase,object);
		mContext = context;
		arrylstCategory = object;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View mView = null;
		if (convertView == null) {
				mView = LayoutInflater.from(mContext).inflate(R.layout.row_showcase,null);
				final ViewHolder viewHolder = new ViewHolder();
				viewHolder.mTextView = (TextView)mView.findViewById(R.id.txtView_Cname);
				mView.setTag(viewHolder);
		}else {
			mView = convertView;
		}
		
		ViewHolder holder = (ViewHolder) mView.getTag();
		holder.mTextView.setText(arrylstCategory.get(position).getTitle());
		
		return mView;
	}
}
